using System;
using System.Text;
using System.Collections.Generic;
using iBeauty.BusinessObjects;
using iBeauty.DAL;

namespace iBeauty.BLL
{
	public class SupplierBLL
	{
		private SupplierDAO _SupplierDAO;

		public SupplierDAO SupplierDAO
		{
			get { return _SupplierDAO; }
			set { _SupplierDAO = value; }
		}

		public SupplierBLL()
		{
			SupplierDAO = new SupplierDAO();
		}
		public List<Supplier> GetSuppliers()
		{
			try
			{
				return SupplierDAO.GetSuppliers();
			}
			catch(Exception ex)
			{
				throw ex;
			}
		}
		public Supplier GetSupplier(string ID)
		{
			try
			{
				return SupplierDAO.GetSupplier(ID);
			}
			catch(Exception ex)
			{
				throw ex;
			}
		}
		public int AddSupplier(Supplier oSupplier)
		{
			try
			{
				return SupplierDAO.AddSupplier(oSupplier);
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
		public int AddSupplier(string ID,DateTime? CreateDate,DateTime? ModifiedDate,DateTime? TimeStamp,string SupplierCode,string SupplierName,string Address,string Email,string Phone,string Fax,int? PaymentType,DateTime? PaymentDate,string ATM,int? AccountId,string Note)
		{
			try
			{
				return SupplierDAO.AddSupplier(ID,CreateDate,ModifiedDate,TimeStamp,SupplierCode,SupplierName,Address,Email,Phone,Fax,PaymentType,PaymentDate,ATM,AccountId,Note);
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
		public int UpdateSupplier(Supplier oSupplier)
		{
			try
			{
				return SupplierDAO.UpdateSupplier(oSupplier);
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
		public int UpdateSupplier(string ID,DateTime? CreateDate,DateTime? ModifiedDate,DateTime? TimeStamp,string SupplierCode,string SupplierName,string Address,string Email,string Phone,string Fax,int? PaymentType,DateTime? PaymentDate,string ATM,int? AccountId,string Note)
		{
			try
			{
				return SupplierDAO.UpdateSupplier(ID,CreateDate,ModifiedDate,TimeStamp,SupplierCode,SupplierName,Address,Email,Phone,Fax,PaymentType,PaymentDate,ATM,AccountId,Note);
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
		public int RemoveSupplier(Supplier oSupplier)
		{
			try
			{
				return SupplierDAO.RemoveSupplier(oSupplier);
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
		public int RemoveSupplier(string ID)
		{
			try
			{
				return SupplierDAO.RemoveSupplier(ID);
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
		public List<Supplier> DeserializeSuppliers(string Path)
		{
			try
			{
				return GenericXmlSerializer<List<Supplier>>.Deserialize(Path);
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
		public void SerializeSuppliers(string Path, List<Supplier> Suppliers)
		{
			try
			{
				GenericXmlSerializer<List<Supplier>>.Serialize(Suppliers, Path);
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
	}
}
